#防止丢剑
execute as @e[type=item] at @s if data entity @s Item.components."minecraft:custom_data"{id:"dagger"} run kill @s
execute as @a[tag=playing] at @s store result score @s SwordCount run clear @s #swords[minecraft:custom_data~{type:"sword"}] 0
execute as @a[tag=playing] at @s if score @s SwordCount matches 0 run loot give @s loot vs:dagger
execute as @a[tag=playing] at @s if score @s SwordCount matches 2.. run clear @s iron_sword[minecraft:custom_data~{id:"dagger"}] 1
#防止丢护甲
execute as @e[type=item] at @s if data entity @s Item.components."minecraft:custom_data"{id:"work_clothes"} run kill @s
execute as @a[tag=playing] at @s store result score @s ArmorCount run clear @s #chest_armor[minecraft:custom_data~{type:"armor"}] 0
execute as @a[tag=playing] at @s if score @s ArmorCount matches 0 run loot give @s loot vs:work_clothes
execute as @a[tag=playing] at @s if score @s ArmorCount matches 2.. run clear @s leather_chestplate[minecraft:custom_data~{id:"work_clothes"}] 1

#
scoreboard players remove @e[scores={invulnerable_timer=1..}] invulnerable_timer 1
scoreboard players reset @e[scores={invulnerable_timer=..0}] invulnerable_timer

#mapBorders
execute as @a[tag=!dev,tag=playing,team=!spectator,x=238,y=58,z=432,dx=50,dy=-122,dz=-352] at @s rotated -90 0 run function vs:system/map_border_tp
execute as @a[tag=!dev,tag=playing,team=!spectator,x=237,y=58,z=432,dx=-90,dy=-122,dz=50] at @s rotated 0 0 run function vs:system/map_border_tp
execute as @a[tag=!dev,tag=playing,team=!spectator,x=147,y=58,z=432,dx=-50,dy=-122,dz=-353] at @s rotated 90 0 run function vs:system/map_border_tp
execute as @a[tag=!dev,tag=playing,team=!spectator,x=147,y=58,z=79,dx=91,dy=-122,dz=-50] at @s rotated 180 0 run function vs:system/map_border_tp
execute as @a[tag=!dev,tag=playing,team=!spectator,x=144,y=67,z=438,dx=101,dy=-9,dz=-363] at @s rotated 0 -90 run function vs:system/map_border_tp

#XYZ
execute as @a store result score @s y run data get entity @s Pos[1]

#放逐
execute as @a[scores={y=..-100},gamemode=!creative,gamemode=!spectator,nbt=!{DeathTime:1s}] at @s run function vs:player_exile

#Leave game
execute as @a[scores={leave_game=1..}] at @s run function vs:system/game/leave_game_rejoin

#TickToTime
execute if score devour_coming system matches -2147483648..2147483647 run scoreboard players operation devour_coming_seconds TimeToTick = devour_coming system
execute if score devour_coming_seconds TimeToTick matches -2147483648..2147483647 run scoreboard players operation devour_coming_seconds TimeToTick /= 20 number